<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateMembersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('members', function (Blueprint $table) {
            $table->unsignedBigInteger('id')->primary();
            $table->string('name')->default('')->comment('昵称');
            $table->string('phone',12)->default('')->comment('绑定的电话')->index('phone');
            $table->enum('role',['PARTNER','MEMBER'])->default('PARTNER')->index('role');
            $table->string('wechat_open_id',64)->default('')->comment('微信openid');
            $table->string('wechat_avatar_url',255)->default('')->comment('微信头像');
            $table->string('alipay_open_id',64)->default('')->comment('支付宝openid');
            $table->string('alipay_avatar_url',255)->default('')->comment('支付宝头像');
            $table->enum('gender',['WOMAN','MAN','NORMAL'])->nullable()->default('NORMAL')->comment('性别');
            $table->rememberToken();
            $table->timestamps();
            $table->softDeletes();
            $table->charset = 'utf8mb4';
            $table->collation = 'utf8mb4_unicode_ci';
            $table->engine = 'InnoDB';
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('members');
    }
}
